/**
 * Clase que hereda sus funciones de búsqueda de filtro.
 */
qx.Class.define("mutual.filter", {
			extend : qx.ui.groupbox.GroupBox,
			
			members : {
				combo : null,
				json: null,
				fnSelected : null,
	
				/**
				 * Permite seleccionar la entidad seleccionada.
				 * @return {json structure} En la forma de {label: 'label seleccionado', value: 'valor seleccionado'}
				 */
				getSelectedEntity : function(){
					var e = {
						label : null,
						value: null
					};
					 if (this.combo.getChildControl("textfield").getValue()) {
						if (this.combo.getChildControl("list").getSelection() != "") {
							e.label = this.combo.getChildControl("list").getSelection()[0].getLabel();
							e.value = this.combo.getChildControl("list").getSelection()[0].getModel();
						} else {
							if (this.combo.getChildControl("list").findItem(this.combo.getChildControl("textfield").getValue())) {
								e.label = this.combo.getChildControl("list").findItem(this.combo.getChildControl("textfield").getValue()).getLabel();
								e.value = this.combo.getChildControl("list").findItem(this.combo.getChildControl("textfield").getValue()).getModel();
							} else {
								e.label = e.value = null;
							}
						}
					} else {
						e.label = e.value = null;
					}
					return e;
				},
				
				/**
				 * Limpia el contenido del combo
				 */
				clearValue : function(){
					this.combo.getChildControl("textfield").setValue("");
				}
			}
		});
